<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>支付</title>
		<script type="text/javascript" src="../js/boot.js"></script>
		<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	</head>

	<body>
	</body>

	<script type="text/javascript">
		// var data = common.getRequestParams("order");
		// var order = JSON.parse(data);
		// var url = window.location.href;
		var order = http.getRequestParams();
		// http.gotoHtml("/weixin/successRecharge.html", order);
		function onBridgeReady() {
			http.post("/wechat/wisonnt/pay.do", order, function(page) {
				if(page.success) {
					WeixinJSBridge.invoke(
						'getBrandWCPayRequest', page,
						function(res) {
							if(res.err_msg == "get_brand_wcpay_request:ok") {
								// alert("支付成功！");
								http.gotoHtml("/weixin/3-1-2-successRecharge.html", order);
							} else {
								// alert(JSON.stringify(res));
								alert("微信冲值失败！");
							}
						}
					);
				} else {
					alert(page.message);
				}
			});
		}

		if(typeof WeixinJSBridge == "undefined") {
			if(document.addEventListener) {
				document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
			} else if(document.attachEvent) {
				document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
				document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
			}
		} else {
			onBridgeReady();
		}
	</script>

</html>